//
// Created by 19594 on 25-7-17.
//
#include "i2c.h"
HAL_StatusTypeDef status;
void AT24C02_WriteByte(uint8_t address,uint8_t data) {
    status=HAL_I2C_Mem_Write(&hi2c1,0xa0,address,I2C_MEMADD_SIZE_8BIT,&data,1,100);
    HAL_Delay(10);
}
void AT24C02_WriteBuffer(uint8_t address,uint8_t *data,uint8_t length) {
    HAL_I2C_Mem_Write(&hi2c1,0xa0,address,I2C_MEMADD_SIZE_8BIT,data,length,100);
    HAL_Delay(10);
}
uint8_t AT24C02_ReadByte(uint8_t address) {
    uint8_t data;
    status=HAL_I2C_Mem_Read(&hi2c1,0xa0,address,I2C_MEMADD_SIZE_8BIT,&data,1,100);
    return data;
}
void At24C02_ReadBuffer(uint8_t address,uint8_t *data,uint8_t length) {
    HAL_I2C_Mem_Read(&hi2c1,0xa0,address,I2C_MEMADD_SIZE_8BIT,data,length,100);
    HAL_Delay(10);
}